#ifndef LOCALSTORAGE_H
#define LOCALSTORAGE_H

#include "livewebentrydao.h"
#include <QSqlDatabase>
#include <QString>

class LocalStorage
{
public:
    static LocalStorage& instance();

    bool init(const QString& path = "yingce.db");
    void close();

    LiveWebEntryDAO* liveWebEntryDAO();

private:
    LocalStorage();
    ~LocalStorage();

    // 禁用拷贝
    LocalStorage(const LocalStorage&) = delete;
    LocalStorage& operator=(const LocalStorage&) = delete;

    QSqlDatabase db_;
    LiveWebEntryDAO* live_web_entry_dao_ = nullptr;

    bool createTables();
};

#endif // LOCALSTORAGE_H
